{block content}
<h2 class="block">Moje úkoly</h2>
<div id="filter" class="block center" data-filter-url="{plink filter!}">
	<form action="" method="get">
		Projekt: <select name="id" id="filter_project">
			<option value="0" data-url="{link filterProject! 0}">Všechny</option>
			{foreach $projects as $project}
			<option value="{$project[id]}" data-url="{link filterProject! $project['id']}">{$project[name]}</option>
			{/foreach}
		</select>
		Zadavatel: <select name="id" id="filter_creator">
			<option value="0" data-url="{link filterCreator! 0}">Všichni</option>
			{foreach $creators as $creator}
			<option value="{$creator[id]}" data-url="{link filterCreator! $creator['id']}">{$creator[name]} {$creator[surname]}</option>
			{/foreach}
		</select>
		Typ úkolu: <select name="id" id="filter_task_type">
			<option value="0" data-url="{link filterTaskType! 0}">Všechny</option>
			{foreach $taskTypes as $taskType}
			<option value="{$taskType[id]}" data-url="{link filterTaskType! $taskType['id']}">{$taskType[name]}</option>
			{/foreach}
		</select>
	</form>
</div>
{snippet tasks}
<div class="block">
	<table class="tasks">
		<tr>
			<th><a href="{link orderBy!, 'priority'}" class="ajax">.</a></th>
			<th><a href="{link orderBy!, 'name'}" class="ajax">Název</a></th>
			<th><a href="{link orderBy!, 'project'}" class="ajax">Projekt</a></th>
			<th><a href="{link orderBy!, 'creator'}" class="ajax">Zadavatel</a></th>
			<th><a href="{link orderBy!, 'deadline'}" class="ajax">Deadline</a></th>
			<th><a href="{link orderBy!, 'completed'}" class="ajax">Dokončeno</a></th>
			<th></th>
		</tr>
{foreach $tasks as $task}
		<tr class="tasks_task_line" data-id="{$task[id]}" data-status="{$task[task_status_id]}" data-completed="{$task[completed]}" data-creator="{= (int)($user->id == $task[creator_id])}" data-worker="{= (int)($user->id == $task[worker_id])}">
			<td class="tasks_priority priority{$task->task_priority[priority]}" title="{$task->task_priority[name]}"></td>
			<td class="tasks_task_name">{$task[name]}</td>
			<td class="tasks_task_name">{$task->project[name]}</td>
			<td class="tasks_worker">{$task->creator[name]} {$task->creator[surname]}</td>
			<td class="tasks_deadline">{if $task->task_status[completed] == 'no' && $task[deadline] > 0}{!$task[deadline]|remaining_days}{/if}</td>
			<td class="tasks_completed"><div class="tasks_completed_graph"><div class="tasks_completed_bar" style="width: {$task[completed]}%"></div><div class="tasks_completed_text">{$task[completed]}%</div></div></td>
			<td class="tasks_actions{if $task[userpriority]!==null} priority{$task[userpriority]}{/if}"><a href="{link Task:task $task[id]}"><img src="{$basePath}/images/info.png" alt="I"></a> <a href="javascript:void(0)" class="menuImage"><img src="{$basePath}/images/action.png" alt="A"></a></td>
		</tr>
{/foreach}
	</table>
	<div class="explanation">
		<div class="exp_priorities">{foreach $priorities as $priority}<div class="exp_priority priority{$priority[priority]}"></div> {$priority[name]} {/foreach}</div>
	</div>
</div>
{/snippet}
{include #contextMenu, 'menuItemCssClass'=>'.tasks_task_line'}
{/block}

{block head}
<link rel="stylesheet" href="{$basePath}/css/{$colorstyle}/tasks.css">
<script type="text/javascript" src="{$basePath}/js/tasks.js"></script>
{/block}